<?php

namespace App\Providers;

use App\Library\FileLibraryInterFace;
use App\Library\Impl\FileLibraryImpl;
use App\Library\Impl\RepotsLibraryImpl;
use App\Library\RepotsLibraryInterFace;
use App\Library\ScheduleLibraryInterFace;
use App\Library\Impl\ScheduleLibraryImpl;
use App\Services\FileServiceInterFace;
use App\Services\Impl\PushServiceImpl;
use App\Services\PushServiceInterFace;
use App\Services\RepotsServiceInterFace;
use Illuminate\Support\ServiceProvider;
use App\Library\UserLibraryInterface;
use App\Library\Impl\UserLibraryImpl;
use App\Library\ZhjyLibraryInterface;
use App\Library\Impl\ZhjyLibraryImpl;
use App\Services\UserServiceInterface;
use App\Services\Impl\UserServiceImpl;
use App\Services\ZhjyServiceInterface;
use App\Services\Impl\ZhjyServiceImpl;
use App\Services\Impl\FileServiceImpl;
use App\Services\Impl\RepotsServiceImpl;
use App\Constant\ApiUrl;
use Illuminate\Support\Facades\Log;
use App\Services\ScheduleServiceInterFace;
use App\Services\Impl\ScheduleServiceImpl;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        Log::info('AppServiceProvider is being registered.');
        $this->app->bind(UserLibraryInterface::class, UserLibraryImpl::class);
        $this->app->bind(UserServiceInterface::class, UserServiceImpl::class);
        $this->app->bind(ZhjyServiceInterface::class, ZhjyServiceImpl::class);
        $this->app->bind(ZhjyLibraryInterface::class, ZhjyLibraryImpl::class);
        $this->app->bind(FileServiceInterFace::class, FileServiceImpl::class);
        $this->app->bind(FileLibraryInterFace::class, FileLibraryImpl::class);
        $this->app->bind(RepotsLibraryInterFace::class, RepotsLibraryImpl::class);
        $this->app->bind(RepotsServiceInterFace::class, RepotsServiceImpl::class);
        $this->app->bind(ScheduleServiceInterFace::class, ScheduleServiceImpl::class);
        $this->app->bind(ScheduleLibraryInterFace::class, ScheduleLibraryImpl::class);
        $this->app->bind(PushServiceInterFace::class, PushServiceImpl::class);

        $this->app->singleton(ApiUrl::class, function ($app) {
            Log::info("创建了单例模式");
            return new ApiUrl();
        });
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        //
    }
}